package com.hzjy.manage.controller;

import java.util.List;

import com.hzjy.api.beans.HzjyDelistInformation;
import com.hzjy.api.service.impl.HzjyDelistInformationServiceImpl;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hzjy.common.annotation.Log;
import com.hzjy.common.core.controller.BaseController;
import com.hzjy.common.core.domain.AjaxResult;
import com.hzjy.common.enums.BusinessType;
import com.hzjy.common.utils.poi.ExcelUtil;
import com.hzjy.common.core.page.TableDataInfo;

/**
 * 摘牌信息Controller
 * 
 * @author hzjy
 * @date 2020-09-21
 */
@RestController
@RequestMapping("/manage/information")
public class HzjyDelistInformationController extends BaseController
{
    @Autowired
    private HzjyDelistInformationServiceImpl hzjyDelistInformationService;

    /**
     * 查询摘牌信息列表
     */
    @PreAuthorize("@ss.hasPermi('manage:information:list')")
    @GetMapping("/list")
    public TableDataInfo list(HzjyDelistInformation hzjyDelistInformation)
    {
        startPage();
        List<HzjyDelistInformation> list = hzjyDelistInformationService.selectHzjyDelistInformationList(hzjyDelistInformation);
        return getDataTable(list);
    }

    /**
     * 导出摘牌信息列表
     */
    @PreAuthorize("@ss.hasPermi('manage:information:export')")
    @Log(title = "摘牌信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(HzjyDelistInformation hzjyDelistInformation)
    {
        List<HzjyDelistInformation> list = hzjyDelistInformationService.selectHzjyDelistInformationList(hzjyDelistInformation);
        ExcelUtil<HzjyDelistInformation> util = new ExcelUtil<HzjyDelistInformation>(HzjyDelistInformation.class);
        return util.exportExcel(list, "information");
    }

    /**
     * 获取摘牌信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('manage:information:query')")
    @GetMapping(value = "selectOne")
    public AjaxResult getInfo(Long id)
    {
        return AjaxResult.success(hzjyDelistInformationService.selectHzjyDelistInformationById(id));
    }

    /**
     * 新增摘牌信息
     */
    @PreAuthorize("@ss.hasPermi('manage:information:add')")
    @Log(title = "摘牌信息", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody HzjyDelistInformation hzjyDelistInformation)
    {
        return toAjax(hzjyDelistInformationService.insertHzjyDelistInformation(hzjyDelistInformation));
    }

    /**
     * 修改摘牌信息
     */
    @PreAuthorize("@ss.hasPermi('manage:information:edit')")
    @Log(title = "摘牌信息", businessType = BusinessType.UPDATE)
    @PostMapping("/update")
    public AjaxResult edit(@RequestBody HzjyDelistInformation hzjyDelistInformation)
    {
        return toAjax(hzjyDelistInformationService.updateHzjyDelistInformation(hzjyDelistInformation));
    }

    /**
     * 删除摘牌信息
     */
    @PreAuthorize("@ss.hasPermi('manage:information:remove')")
    @Log(title = "摘牌信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(hzjyDelistInformationService.deleteHzjyDelistInformationByIds(ids));
    }

    /**
     * 删除摘牌信息
     */
    @PreAuthorize("@ss.hasPermi('manage:information:delete')")
    @Log(title = "摘牌信息", businessType = BusinessType.DELETE)
    @PostMapping("delete")
    public AjaxResult delete(@RequestBody HzjyDelistInformation hzjyDelistInformation)
    {
        return toAjax(hzjyDelistInformationService.deleteHzjyDelistInformationById(hzjyDelistInformation.getId()));
    }
}
